package com.trhui.mallbook.common.utils;

import com.trhui.mallbook.common.exception.FailureCode;
import com.trhui.mallbook.common.exception.SdkClientException;

/**
 * @Author xgc
 * @Date 2023/08/24 16:40
 **/
public class ValidationUtil {

    public static void checkNotNullAndThrow(Object ref, String errorMessage) {
        if (ref == null) {
            throw new SdkClientException(errorMessage);
        }
    }

    public static void checkNotNullAndThrow(Object ref, FailureCode codes) {
        if (ref == null) {
            throw new SdkClientException(codes);
        }
    }


    public static void checkNotNullAndThrow(String ref, String errorMessage) {
        if (StringUtil.isBlank(ref)){
            throw new SdkClientException(errorMessage);
        }
    }
}
